package leetcode.leetcode_48;

class Solution {
    public void rotate(int[][] matrix) {
        int n = matrix.length;
        int m = matrix[0].length;
        for (int i = 0; i < n; i++){
            for (int j = i; j < m; j++){
                int temp = matrix[i][j];
                matrix[i][j] = matrix[j][i];
                matrix[j][i] = temp;
            }
        }
//        行变化
        for (int i = 0 ;i<n;i++){
            for (int j =0 ;j<m/2;j++){
                int temp = matrix[i][j];
                matrix[i][j]=matrix[i][m-1-j];
                matrix[i][m-1-j] = temp;
            }
        }
    }
}